package com.spzx.JUC1.test2;

public class ThreadDemo1 extends MyThread{

    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            //加入其他线程
            if (i == 10){
                MyThread myThread = new MyThread();
                myThread.setName("线程1");
                myThread.start();
                try{
                    myThread.join();
                }catch (InterruptedException e){
                    e.printStackTrace();
                }
            }
            System.out.println(currentThread().getName() + "  " + i);
        }
    }
}
